package com.airsystem.pos.bengkel.model;

import java.awt.GridBagLayout;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;

import com.airsystem.pos.bengkel.component.DesktopFrame;
import com.toedter.calendar.JDateChooser;

/**
 * @author Fanny Irawan Sutawanir (fannyirawans@gmail.com)
 */
public class SparepartOrderModel extends DesktopFrame {
	protected int row = 0;

	protected boolean isGridClicked = false;

	protected GridBagLayout baseLayout = new GridBagLayout();
	protected GridBagLayout panelLayout = new GridBagLayout();

	protected JScrollPane scrollPane = new JScrollPane();
	protected JScrollPane tablesparepartsScroll = new JScrollPane();

	protected JPanel basePanel = new JPanel();
	protected JPanel buttonPanel = new JPanel();
	protected JPanel fieldPanel = new JPanel();

	protected JLabel tanggalLabel = new JLabel();
	protected JLabel sparepartLabel = new JLabel();
	protected JLabel kendaraanLabel = new JLabel();
	protected JLabel jenisLabel = new JLabel();
	protected JLabel orderLabel = new JLabel();
	protected JLabel hargaLabel = new JLabel();
	protected JLabel distributorLabel = new JLabel();
	protected JLabel pembayaranLabel = new JLabel();
	protected JLabel totalLabel = new JLabel();

	protected JTextField sparepartField = new JTextField();
	protected JTextField kendaraanField = new JTextField();
	protected JTextField jenisField = new JTextField();
	protected JTextField orderField = new JTextField();
	protected JTextField hargaField = new JTextField();
	protected JTextField distributorField = new JTextField();
	protected JTextField totalField = new JTextField();
	protected JTextField idField = new JTextField();

	protected JComboBox pembayaranCombo = new JComboBox();

	protected JButton searchButton = new JButton();
	protected JButton sparepartButton = new JButton();
	protected JButton addButton = new JButton();
	protected JButton submitButton = new JButton();
	protected JButton updateButton = new JButton();
	protected JButton deleteButton = new JButton();
	protected JButton cancelButton = new JButton();

	protected static JDateChooser tanggalChooser = new JDateChooser();

	protected static JTable tableSpareparts = new JTable();

	protected static final String[] COMBOS = { "TUNAI", "HUTANG" };

	protected static final String[] COLUMNS = { "Sparepart", "Kendaraan", "Jenis",
												"Harga", "Pesan", "Total Harga",
												"Distributor", "Pembayaran", "ID" };

	protected DefaultTableModel tableModel = new DefaultTableModel(new Object[][] {}, COLUMNS) {

		boolean[] canEdit = new boolean[] { false, false, false,
											false, false, false,
											false, false, false };

		public boolean isCellEditable(int rowIndex, int columnIndex) {
			return canEdit[columnIndex];
		}
	};

	public SparepartOrderModel() {
		super();
	}

	public JDateChooser getTanggalChooser() {
		return tanggalChooser;
	}

	public JTable getTableSpareparts() {
		return tableSpareparts;
	}
}